//
//  AboutViewController.m
//  TQY
//
//  Created by 甘世清 on 2024/8/23.
//

#import "AboutViewController.h"

@interface AboutViewController ()
@property (nonatomic , strong)SQCustomButton * rightBtn;
@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.zx_navTitle = SQNSLocalString(@"关于我们");
    // Do any additional setup after loading the view.
}

- (void)SQ_UIViewForSelfView{
    UIImageView * bgImageView = [[UIImageView alloc]init];
    bgImageView.image = SQGetImage(@"二级背景");
    bgImageView.contentMode = UIViewContentModeScaleAspectFill;
    [self.view addSubview:bgImageView];
    [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    UIImageView * image = [[UIImageView alloc]init];
    image.image = SQGetImage(@"logo");
    image.layer.cornerRadius = 12;
    image.layer.masksToBounds = YES;
    image.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.size.mas_equalTo(90);
            make.top.equalTo(self.zx_navBar.mas_bottom).offset(100);
    }];
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    NSString *applocalversion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
 
    
    UILabel * label = [[UILabel alloc]init];
    label.textColor = UIColor.blackColor;
    label.font = FONT_MEDIUM(18);
    label.text = [NSString stringWithFormat:@"Version: %@",applocalversion];
    [self.view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.top.equalTo(image.mas_bottom).offset(20);
    }];
    
    UILabel * label2 = [[UILabel alloc]init];
    label2.textColor = SQColor666666;
    label2.font = FONT_REGULAR(14);
    label2.text =  @"蜀ICP备2024070911号-3A";
    [self.view addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.view);
            make.bottom.equalTo(self.view.mas_bottom).offset(-FootHeight-20);
    }];
    
    [self.view addSubview:self.rightBtn];
    [self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-FootHeight-80);
        make.height.mas_equalTo(48);
        make.centerX.equalTo(self.view);
        make.width.mas_equalTo(SCREEN_WIDETH - 120);
    }];
    
    [self.rightBtn setTouchBlock:^(SQCustomButton * _Nonnull button) {
        NSString *str = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id6736890354"];
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str] options:@{} completionHandler:^(BOOL success) {
        }];
    }];
}
- (SQCustomButton *)rightBtn{
    if (!_rightBtn) {
        _rightBtn = [[SQCustomButton alloc]initType:SQCustomButtonTopImageType imageSize:CGSizeMake(0, 0) midmargin:0];
        _rightBtn.text = SQNSLocalString(@"给个好评");
        _rightBtn.SQBackimageView.contentMode = UIViewContentModeScaleAspectFill;
        _rightBtn.SQBackimageView.image = SQGetImage(@"vip矩形");
        _rightBtn.textColor = UIColor.whiteColor;
        _rightBtn.font = FONT_REGULAR(16);
        _rightBtn.backgroundColor = SQColor3DA59D;
        _rightBtn.layer.cornerRadius = 24;
    }
    return _rightBtn;
}
@end
